package edu.sctu.practice.class01.zhengsenwen.assign.assign03.test03;

/**
 * Created by zhengsenwen on 2015/11/19.
 */
public class Client {

    //            （6）程序的主方法中使用clone方法完成两个CloneableCircle类对象的深拷贝。

    public static void main(String[] args) throws CloneNotSupportedException {
        Name name = new Name();
        name.setFirstName("Zheng");
        name.setMiddleName("sen");
        name.setLastName("wen");


        CloneableCircle cloneableCircle = new CloneableCircle();
        cloneableCircle.setCreator(name);

        System.out.println("cloneableCircle "+ cloneableCircle.getCreator().firstName +
                cloneableCircle.getCreator().getMiddleName() + cloneableCircle.getCreator().getLastName());

        CloneableCircle cloneableCircle1 = (CloneableCircle) cloneableCircle.clone();
        cloneableCircle1.getCreator().setFirstName("郑");
        cloneableCircle1.getCreator().setMiddleName("森");
        cloneableCircle1.getCreator().setLastName("文");

        System.out.println("cloneableCircle "+ cloneableCircle1.getCreator().firstName +
                cloneableCircle1.getCreator().getMiddleName() + cloneableCircle1.getCreator().getLastName());
    }

}
